using System;
using System.Reflection;

using System.Collections;
using System.Collections.Generic;

using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace CSharpDistilled.Diagnostics
{
    /// <summary>
    /// Provides unit testing for the <see cref="T:CSharpDistilled.Diagnostics.GraphicsProcessor"/> class.
    /// </summary>
    [TestClass]
    public class GraphicsProcessorUnitTest
    {
        #region public GraphicsProcessorUnitTest()

        /// <summary>
        /// Initializes a new instance of the <see cref="T:GraphicsProcessorUnitTest"/> class.
        /// </summary>
        public GraphicsProcessorUnitTest()
        {

        }

        #endregion

        #region public void GetGraphicsProcessorsTest()

        /// <summary>
        /// Unit test to exercise the <see cref="M:CSharpDistilled.Diagnostics.GraphicsProcessor.GetGraphicsProcessors"/> static method.
        /// </summary>
        [TestMethod]
        public void GetGraphicsProcessorsTest()
        {
            IList<GraphicsProcessor> processors = GraphicsProcessor.GetGraphicsProcessors();

            Assert.IsNotNull(processors, "GraphicsProcessor.GetGraphicsProcessors() returned null.");

            Assert.IsTrue(processors.Count > 0, "GraphicsProcessor.GetGraphicsProcessors() returned an IList with a Count of zero.");

            foreach (GraphicsProcessor processor in processors)
            {
                Assert.IsNotNull(processor, "GraphicsProcessor.GetGraphicsProcessors() returned an IList containing a null GraphicsProcessor instance.");

                Assert.IsFalse(string.IsNullOrEmpty(processor.Name),
                    "GraphicsProcessor.GetGraphicsProcessors() returned an IList containing a GraphicsProcessor instance with either a null or empty Name property.");
                Assert.IsFalse(string.IsNullOrEmpty(processor.Description),
                    "GraphicsProcessor.GetGraphicsProcessors() returned an IList containing a GraphicsProcessor instance with either a null or empty Description property.");
                Assert.IsFalse(string.IsNullOrEmpty(processor.DeviceId),
                    "GraphicsProcessor.GetGraphicsProcessors() returned an IList containing a GraphicsProcessor instance with either a null or empty DeviceId property.");

                Assert.IsNotNull(processor.DriverVersion,
                    "GraphicsProcessor.GetGraphicsProcessors() returned an IList containing a GraphicsProcessor instance with a null DriverVersion property.");

                Assert.IsTrue(processor.Memory > 0,
                    "GraphicsProcessor.GetGraphicsProcessors() returned an IList containing a GraphicsProcessor instance with an invalid value for the Memory property.");
            }
        }

        #endregion
    }
}

